package com.yiming.rabbitmq.service.impl;

import com.yiming.rabbitmq.service.FanoutSendMessageService;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 曾衣铭
 * @Date: 2020/09/27/10:33
 * @Description:
 */
@Service
public class FanoutSendMessageServiceimpl implements FanoutSendMessageService {
    @Autowired
    private AmqpTemplate amqpTemplate;
    @Override
    public void sendMessage(String message) {
        System.out.println(message);
        amqpTemplate.convertAndSend("fanout_exchange","",message);
    }
}
